﻿<?php

date_default_timezone_set('Asia/Shanghai');
header("Content-type:text/html;charset=utf-8");
include_once('Model.class.php');
$model = M('game');

if(@$_POST['mobile']){
    $add = array();
    $add['mobile'] = trim(@$_POST['mobile']);
    $add['time'] = trim(@$_POST['time']);
    $add['score'] = trim(@$_POST['score']);
    $add['sessionid'] = trim(@$_POST['sessionid']);
    $add['date'] = date("Y-m-d H:i:s");

    $result = $model->add($add);
    if($result){
        $id = $model->getLastInsID();
        echo '{"id":' . $id . ', "update": "ok"}';
    }else{
        echo '{"err":"failed"}';
    }
}